﻿using Ninject;
using Ninject.Modules;

namespace HobSoft.SoccerBet2014.Client
{
    using Domain.ClientService;
    using Domain.Common.Factory;
    using Domain.Common.Service;
    using Domain.Common.Site;
    using Domain.Common.SiteContext;
    using Domain.DataService;
    using Domain.Factory;
    using Domain.Implementation.Local;
    using Domain.IRepositories;
    using Domain.Schedule;

    public class RepositoryIocModule : NinjectModule
    {
        public override void Load()
        {
            Bind<IBFAccountRepository>()
                .To<BFAccountRepository>()
                .InSingletonScope();
            Bind<IGameRepository>()
                .To<GameRepository>()
                .InSingletonScope();
            Bind<IMarketRepository>()
                .To<MarketRepository>()
                .InSingletonScope();
            Bind<IOddsRepository>()
                .To<OddsRepository>()
                .InSingletonScope();
            Bind<IBookmakerRepository>()
                .To<BookmakerRepository>()
                .InSingletonScope();
            Bind<IBmAccountRepository>()
                .To<BmAccountRepository>()
                .InSingletonScope();
            Bind<ICookiesManager>()
                .To<CookiesManager>()
                .InSingletonScope();
            Bind<ISiteContextRepository>()
                .To<SiteContextRepository>()
                .InSingletonScope();
            Bind<Configuration.BettingKeyRepository>()
                .ToSelf()
                .InSingletonScope();

            Bind<IBetGameDataService>()
                .To<BetGameDataService>()
                .InSingletonScope();
            Bind<IBfEventDataService>()
                .To<BfEventDataService>()
                .InSingletonScope();
            Bind<IbcSessionManager>()
                .ToSelf();
            Bind<SboSessionManager>()
                .ToSelf();
            Bind<HgSessionManager>()
                .ToSelf();

            Bind<IBetSiteManagerFactory>()
                .To<SiteManagerFactory>()
                .InSingletonScope();


            Bind<ITimer>()
                .To<Common.ScheduleManagerTimer>();
            Bind<IBetSiteServiceCallback>()
                .To<Service.BetSiteServiceCallback>()
                .InSingletonScope();
            Bind<IScheduleTimerFactory>()
                .To<ScheduleTimerFactory>()
                .InSingletonScope();
            Bind<IBfManagerFactory>()
                .To<BfManagerFactory>()
                .InSingletonScope();

            ContextManager.Repository = Kernel.Get<ISiteContextRepository>();
        }
    }
}
